import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';

import 'package:smart_translator/app/routes/app_pages.dart';
import 'package:smart_translator/app/storage/StorageManager.dart';
import 'package:smart_translator/app/utils/CommonUtil.dart';

import '../../../const/AppConst.dart';

class LauncherController extends GetxController {

  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onReady() {
    super.onReady();
    Future.delayed(Duration(seconds: 2),() {
      print('jumpping ...');
      if (CommonUtil.getCurrentLoginToken() != '') {
        Get.toNamed(Routes.HOME);
        /*if(!CommonUtil.hasEnteredAPPBefore()) {
          StorageManager.getStorage().write(AppConst.FIRST_LOGIN, true);
          Get.toNamed(Routes.CHOOSE_DEVICE);
        } else {
         Get.toNamed(Routes.HOME);
        }*/

      } else {
        Get.toNamed(Routes.LOGIN);
      }


    });
  }

  @override
  void onClose() {
    super.onClose();
  }
}
